//
//  NSString+ridHTMLStr.m
//  Stars
//
//  Created by hst on 16/3/18.
//  Copyright © 2016年 hst. All rights reserved.
//

#import "NSString+ridHTMLStr.h"

@implementation NSString (ridHTMLStr)


-(NSString *) stringByStrippingHTML {
    NSRange r;
    NSString *s = [self copy];
    while ((r = [s rangeOfString:@"<[^>]+>" options:NSRegularExpressionSearch]).location != NSNotFound)
        s = [s stringByReplacingCharactersInRange:r withString:@""];
    
    while ((r = [s rangeOfString:@"&nbsp;" options:NSRegularExpressionSearch]).location != NSNotFound){
        s = [s stringByReplacingCharactersInRange:r withString:@" "];
    }
    while ((r = [s rangeOfString:@"&nbsp;" options:NSRegularExpressionSearch]).location != NSNotFound){
        s = [s stringByReplacingCharactersInRange:r withString:@" "];
    }
    return s;
}

@end
